# 作者：小七
# 2024年12月26日
def use_while1():
    i = 1
    while i <= 5:
        print("Hello Python")

        i = i + 1
    print("循环结束后的 i = %d" % i)


use_while1()


def use_continue():
    i = 1
    sum = 0
    while i <= 100:
        if i % 2 == 1:
            i = i + 1
            continue
        sum += i
        i += 1
    print("1+2+...+100 =", sum)
    print(f"i = {i}")


use_continue()


def use_break():
    i = 1
    sum = 0
    while i <= 100:
        if sum > 2000:
            break
        sum += i
        i += 1
    print("1+2+...+100 =", sum)
    print(f"i = {i}")


use_break()


def use_print():
    print("Hello", end=" ")
    print("Python", end=" ")
    print("howareyou")


use_print()


def use_for():
    my_list = [1, 2, 3, 4, 5]
    for i in my_list:
        print(i)
    print('-' * 50)
    print(i)


use_for()


def use_for_else():
    for i in range(10):
        if i == 15:
            print("found 15")
            break
    else:
        print("don't find")


use_for_else()
